package com.LeeCode;

/**
 * 相邻值的按位异或
 */

public class Code2683 {
    public static void main(String[] args) {
        int[] nums = {1, 0};
        System.out.println(new Code2683().doesValidArrayExist(nums));
    }

    public boolean doesValidArrayExist(int[] derived) {
        int n = derived.length;
        int a0 = 0;
        for (int i = 0; i < n - 1; i++) {
            a0 = a0 ^ derived[i];
        }
        return a0 == derived[n - 1];
    }
}
